package xyz.zeer.endangeredanimal;

import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;

public class OtherFragment extends Fragment{

    private RecyclerView yrs_otherRecyclerView;
    private OtherAdapter yrs_otherAdapter;
    private ArrayList<OtherModel> yrs_otherList;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.yrs_other_fragment, container, false);
        yrs_otherRecyclerView = view.findViewById(R.id.recyclerViewOther);

        addingOhter();
        buildRecyclerViewStat();

        return view;
    }

    private void buildRecyclerViewStat() {
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this.getActivity());
        linearLayoutManager.setOrientation(RecyclerView.VERTICAL);
        yrs_otherRecyclerView.setLayoutManager(linearLayoutManager);
        yrs_otherAdapter = new OtherAdapter(yrs_otherList, getContext());
        yrs_otherRecyclerView.setAdapter(yrs_otherAdapter);
    }

    private void addingOhter() {
        yrs_otherList = new ArrayList<>();
        yrs_otherList.add(new OtherModel("世界自然基金会","www.worldwildlife.org"));
        yrs_otherList.add(new OtherModel("软件作者","www.zeer.xyz"));
    }
}
